package com.example.egweibo1.base.exception;

import com.example.egweibo1.base.response.JsonResult;
import com.example.egweibo1.base.response.Status;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler
    public JsonResult exceptionHandler(Throwable e){
        String data = e.getMessage();
        log.error("Throwable={}",data);
        return new JsonResult(Status.FAIL,data);
    }
}
